﻿CREATE PROCEDURE [dbo].[usp_select_Fault_Count_By_Application_GroupByServices]
(
        @Application       varchar(255)      = NULL
	   ,@StartDate         datetime         = NULL
	   ,@EndDate           datetime         = NULL
)
AS

SET NOCOUNT ON;
SET @EndDate = DATEADD(day,1,@EndDate)

select ServiceName,count(ServiceName) Total from dbo.Fault
where [Application] = @Application
and [DateTime] between @StartDate and @EndDate

group by   ServiceName
order by   ServiceName


SET NOCOUNT OFF;
